<?php
namespace app\admin\controller;

use think\Controller;
use think\Db;
use think\Request;

class Index extends Base
{
    public function index()
    {

        return $this->fetch();
    }

    public function welcome(Request $request)
    {

        $version = Db::query('SELECT VERSION() AS ver');
        $config  = [
            'url' => $_SERVER['HTTP_HOST'],
            'document_root' => $_SERVER['DOCUMENT_ROOT'],
            'server_os' => PHP_OS,
            'server_port' => $_SERVER['SERVER_PORT'],
            'server_soft' => $_SERVER['SERVER_SOFTWARE'],
            'php_version' => PHP_VERSION,
            'mysql_version' => $version[0]['ver'],
            'timezone' => date_default_timezone_get(),
            'max_upload_size' => ini_get('upload_max_filesize')
        ];

        return view('welcome', compact('config'));
    }

    public function getRole()
    {
        $role = session('url', '', 'admin');
        dump($role);
//        //获取session里的roleid
//        $role = session('roleId', '', 'admin');
//        //到权限表读取栏目id
//        $pri_info = model('Pri')->where('column_id ='.$role)->find();
//        //到栏目表里读取栏目信息
//        $column_info = model('Column')->where('id = '.$pri_info['column_id'])->find();
//
//        $column_list = model('Column')->where('pid = 0')->select();
//        return json($column_list);
    }
}
